package com.apes.auto.maintain.service;

import com.apes.auto.maintain.model.MaintainPeriodRange;
import com.apes.auto.maintain.repository.PeriodRangeRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName PeriodRangeService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/8/9 10:05
 * @Version 1.0
 **/
@Service("periodRangeService")
public class PeriodRangeService extends DomainService {
    @Autowired
    private PeriodRangeRepository periodRangeRepository;

    public MaintainPeriodRange save(SimpleRequest request) {
        MaintainPeriodRange o = request.getO(MaintainPeriodRange.class);
        MaintainPeriodRange maintainPeriodRange = periodRangeRepository.saveAndFlush(o);
        return maintainPeriodRange;
    }

    public String delete(SimpleRequest request) {
        MaintainPeriodRange o = request.getO(MaintainPeriodRange.class);
        periodRangeRepository.delete(o);
        return "删除成功";
    }
}
